﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;


namespace Model
{
    public partial class Tbl001_UsersInfo 
    {
        public DataTable LoadDataTable(string sqlCmd)
        {
            DataTable dt = new DataTable();
            SqlCommand cmd = new SqlCommand();
            cmd.Connection = _mainConnection;
            cmd.CommandText = sqlCmd;
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            try
            {
                _mainConnection.Open();
                da.Fill(dt);
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message);
            }
            finally
            {
                _mainConnection.Close();
                cmd.Dispose();
                da.Dispose();
            }
            return dt;
        }
    }
}
